home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
551-575
/
disk_559
/
apig
/
apiglib_v11.lzh
/
e4_areafills.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-09-28
|
5KB
|
176 lines
/* example of area fill flood functions */
/* */
x = addlib("apig.library",0,-30,0)
portname = "example4_port"
p = openport(portname)
call set_apig_globals()
scrtitle = " This is Your New Screen !"
wintitle = " This is your Window Title"
winidcmp = CLOSEWINDOW
winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO
scr = openscreen(0,0,640,400,3,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
/* open window */
w1 = openwindow(portname,0,0,640,400,2,4,winidcmp,winflags,wintitle,scr,0,0,0)
rpw1 = getwindowrastport(w1)
pat = allocmem(4,MEMF_CLEAR) /* 4 bytes to use for area fill pattern */
z = export(pat,'5555 aaaa'x,4) /* define fill pattern */
z = setafpt(rpw1,pat,1) /* set fill pattern */
z = makearea(w1,640,400,3000) /* init. window rastport for area fills */
if z = 0 then call getout()
do twice = 1 to 2
if twice = 2 then
z = setopen(rpw1,1) /* set outline pen second time around */
pen = 1
do y = 30 to 300 by 60
do x = 10 to 600 by 60
if pen > 7 then pen = 1
z = setapen(rpw1,pen)
z = areamove(rpw1,x,y)
z = areadraw(rpw1,x+50,y)
z = areadraw(rpw1,x+50,y+50)
z = areadraw(rpw1,x,y+50)
z = areadraw(rpw1,x,y)
z = areaend(rpw1)
pen = pen + 1
end
end
wait 2 secs
z = setopen(rpw1,0)
z = clearscreen(rpw1,0,0)
end
afill:
z = freearea(w1)
z = makearea(w1,640,400,3000)
z = export(pat,'0101 0101'x,4)
z = setdrmd(rpw1,JAM2)
z = setapen(rpw1,3)
z = setbpen(rpw1,4)
z = setopen(rpw1,1)
z = setafpt(rpw1,pat,0)
z = move(rpw1,420,140)
z = areacircle(rpw1,420,140,60)
say "z = " z
z = areaend(rpw1)
z = export(pat,'f66f 6ff6'x,4)
z = setapen(rpw1,6)
z = setbpen(rpw1,7)
z = setopen(rpw1,2)
z = setafpt(rpw1,pat,1)
z = areacircle(rpw1,120,240,60)
say "z = " z
z = areaend(rpw1)
z = export(pat,'2222 2222'x,4)
z = setapen(rpw1,1)
z = setbpen(rpw1,2)
z = setopen(rpw1,3)
z = setafpt(rpw1,pat,1)
z = areaellipse(rpw1,320,180,60,40)
say "z = " z
z = areaend(rpw1)
z = export(pat,'ffff ffff'x,4)
z = setapen(rpw1,5)
z = setbpen(rpw1,6)
z = setopen(rpw1,4)
z = setafpt(rpw1,pat,1)
z = areaellipse(rpw1,220,300,60,40)
say "z = " z
z = areaend(rpw1)
wait 5 secs
z = setbpen(rpw1,0)
z = clearscreen(rpw1,0,0)
x = 10
y = 100
z = export(pat,'3333 cccc'x) /* changing pattern */
z = setapen(rpw1,2)
z = areamove(rpw1,x,y)
z = areadraw(rpw1,x,y+100)
z = areadraw(rpw1,x+400,y+100)
z = areadraw(rpw1,x+400,y)
z = areadraw(rpw1,x+350,y)
z = areadraw(rpw1,x+350,y+90)
z = areadraw(rpw1,x+50,y+90)
z = areadraw(rpw1,x+50,y)
z = areadraw(rpw1,x,y)
z = areaend(rpw1)
z = export(pat,'5775 a00a'x,4) /* changing pattern */
z = setapen(rpw1,5)
z = areamove(rpw1,110,100)
z = areadraw(rpw1,280,100)
z = areadraw(rpw1,280,150)
z = areadraw(rpw1,110,150)
z = areadraw(rpw1,110,100)
z = areaend(rpw1)
/* make a border array of XY points */
barray = allocmem(5*4,MEMF_CLEAR) /* need 20 bytes, 5points * 2x * 2y */
x = setx(barray,0,0) ; y = sety(barray,0,0)
x = setx(barray,1,150) ; y = sety(barray,1,0)
x = setx(barray,2,150) ; y = sety(barray,2,100)
x = setx(barray,3,0) ; y = sety(barray,3,100)
x = setx(barray,4,0) ; y = sety(barray,4,0)
border1 = makeborder(w1,barray,5,40,20,1,0,JAM2,0)
z = drawborder(rpw1,border1,0,220)
z = pitext(rpw1,200,270," <--- gonna flood this area ",1,2,JAM2,0)
wait 3 sec
z = setopen(rpw1,1) /* make OPen same as border color */
z = flood(rpw1,0,60,250) /* choosing a point inside the border */
wait 1 sec
z = pitext(rpw1,200,282," watch what happens when the border color is broken",1,2,JAM2,0)
wait 3 sec
z = pitext(rpw1,100,294," BROKE THE BORDER, will re-flood this area ",1,2,JAM2,0)
wait 1 sec
z = setopen(rpw1,1) /* make OPen same as border color */
z = pitext(rpw1,100,306," FLOODING NOW ",1,2,JAM2,0)
z = flood(rpw1,0,60,250) /* choosing a point inside the border */
z = freemem(barray,5*4)
z = pitext(rpw1,300,370," DONE ",1,2,JAM2,0)
do forever /* IDCMP loop, wait for CLOSEWINDOW message */
x = waitpkt(portname)
do forever
msg = '0000 0000'x
msg = getpkt(portname)
if msg = '0000 0000'x then leave
class = getarg(msg,0)
if class = CLOSEWINDOW then exitme = 1
x = reply(msg,0)
end
if exitme = 1 then leave
end
z = freearea(w1) /* when done with areafills, free mem */
getout:
z = freemem(pat,4)
z = closewindow(w1)
z = closescreen(scr)
exit